//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tyr_airdrop\fn_createBox.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_pos","_box","_side","_smoke","_box_type"];
DEFAULT_PARAM(_pos,0,[]);
DEFAULT_PARAM(_side,1,playerSide);

_box_type = missionNameSpace getVariable [format["%1_%2",QGVAR(BOX_TYPE),_side],GVAR(BOX_TYPE_WEST)];
_box = createVehicle [_box_type,_pos,[], random(360), "NONE"];
_box setPos _pos;
if (GVAR(WITH_SMOKESHELL)) then {
	_box spawn {
		private "_smoke";
		_smoke = "SmokeShellPurple" createVehicle (getPos _this);
		sleep 0.1;
		_smoke attachTo [_this,[0,0,1.4]];
		sleep 1;
		_smoke setDamage 1.1;
		TRACE_1("Smoke",_smoke);
	};
};

_box setVariable ["TYR_AIRDROP_BOX",true,true];
// So you can pick the box up with the BTC Revive vehicles
_box setVariable ["BTC_AMMO_BOX",true,true];
clearBackpackCargoGlobal _box;
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
clearItemCargoGlobal _box;
//[2,[_box,_side],QUOTE(FUNC(fillBox))] call mso_core_fnc_ExMP;
if !(isNil "TYR_DROP_AMMO_BOX_CONTENT") then {
	_side = "TYR_DROP";
};
["MSO","FillAmmoBox",[_box,_side],2] call ioc_fnc_rpc;

TRACE("End");
TMFPROFILERSTOP;
